package com.jm.reggie.controller;

import com.jm.reggie.common.R;
import com.jm.reggie.entity.OrderDetail;
import com.jm.reggie.entity.Orders;
import com.jm.reggie.service.OrderDetailService;
import com.jm.reggie.service.OrdersService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Slf4j
@RequestMapping("/order")
@RestController
public class OrdersController {
    @Resource
    private OrdersService ordersService;
    @Resource
    private OrderDetailService orderDetailService;

    /**
     * 用户下单
     * @param orders
     * @return
     */
    @PostMapping("submit")
    public R<String> submit(@RequestBody Orders orders){
        ordersService.submit(orders);
        return R.success("用户下单成功");
    }
}
